/**
 * @description: 全局状态store
 * @author: Jvyou
 * @createTime: 2025/11/23 16:31
 */

import {layoutThemeConfig} from '@/config/layout-theme.ts'
import {defineStore} from "pinia";
import {useLayoutTheme} from "@/compsables/layout-theme.ts";

export const useAppStore = defineStore('app', () => {

  // 如果开发环境，则直接使用配置文件，开发模式则从 local storage 里面读取
  const defaultLayout = import.meta.env.DEV ? layoutThemeConfig : useLayoutTheme()
  const layout = reactive(unref(defaultLayout))

  const toggleLayout = (type: 'top' | 'mix' | 'side') => {
    layout.layout =  type
  }

  return {
    layout,
    toggleLayout
  }
})


